<?php
/**
 * Created by PhpStorm.
 * User: moquan
 * Date: 2018/6/11
 * Time: 17:02
 */

namespace app\lib\exception;


use think\Exception;

class BaseException extends Exception {

    //http
    public $code = 400;

    public $msg = "参数错误";

    //自定义错误码
    public $errorCode = 10000;

    public function __construct( $param = [] ) {
        if( !is_array( $param ) ){
            return;
        }
        if( array_key_exists( 'code', $param ) ){
            $this->code = $param['code'];
        }
        if( array_key_exists( 'msg', $param ) ){
            $this->msg = $param['msg'];
        }
        if( array_key_exists( 'errorCode', $param ) ){
            $this->errorCode = $param['errorCode'];
        }
    }
}